﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WowParserLib.Events;
using WowParserLib.Events.SuffixArgs;

namespace WowParserLib.EventParsers
{
    public class DamageArgsParser : EventArgsParser
    {

        public DamageArgsParser(int startIndex)
            :base(startIndex)
        {
        }

        #region IArgsParser<DamageArgs> Members

        public override EventArguments Parse(string[] args)
        {
            //int amount, SpellSchool school, int resisted, int blocked, unt absorbed, bool critical, bool glancing, bool crushing
            // 10 - ...
            //SPELL_DAMAGE,0x0000000001638224,"Xale",0x511,0xF130006317000274,"Sunblade Arch Mage",0xa48,25454,"Earth Shock",0x8,1090,8,0,0,0,nil,nil,nil
            int amount = int.Parse(args[StartIndex]);
            SpellSchool school = (SpellSchool)int.Parse(args[StartIndex + 1]);
            int resisted = int.Parse(args[StartIndex + 2]);
            int blocked = int.Parse(args[StartIndex + 3]);
            int absorbed = int.Parse(args[StartIndex + 4]);

            bool critical = ParseBool(args[StartIndex+5]);
            bool glancing = ParseBool(args[StartIndex + 6]); 
            bool crushing = ParseBool(args[StartIndex + 7]); 

            return new DamageArgs(amount, school, resisted, blocked, absorbed, critical, glancing, crushing);
        }

        #endregion
    }
}
